

package com.hazelcast.splitbrainprotection;

import com.hazelcast.cluster.Member;

import java.util.Collection;

/**
 * {@link SplitBrainProtectionFunction}s which implement this interface will be notified of member heartbeats.
 */
@FunctionalInterface
public interface HeartbeatAware {

    /**
     * Notifies of a received heartbeat. This method is always invoked before
     * {@link SplitBrainProtectionFunction#apply(Collection)} so the {@code SplitBrainProtectionFunction} can update
     * its internal state before deciding on whether the minimum cluster size property
     * (for the purpose of split brain detection) is satisfied.
     *
     * @param member    member from which heartbeat was received
     * @param timestamp timestamp on which heartbeat was received
     */
    void onHeartbeat(Member member, long timestamp);
}
